package com.example.homecunter.video.model;

import com.example.common.utils.BaseEntity;
import com.example.homecunter.video.api.TypeApi;
import com.example.homecunter.video.entity.ChannelEntity;
import com.example.homecunter.video.entity.VideoEntity;
import com.example.mvvmcore.retrofit.HttpFactory;
import com.example.mvvmcore.retrofit.ProductType;
import com.example.mvvmcore.model.IModel;

import java.util.List;

import io.reactivex.Flowable;

public class ChannelModel implements IModel {

    public Flowable<BaseEntity<List<ChannelEntity>>> channel(){
        TypeApi api = HttpFactory.getInstance().factoryTyoe(ProductType.NETWORK).getRetrofit("http://82.156.173.100:9999/").create(TypeApi.class);//RetrofitFactory.getInstance().create(TypeApi.class);//

        return api.getType();
    }



    public Flowable<BaseEntity<List<VideoEntity>>> video(int channelid,int page){
        TypeApi api = HttpFactory.getInstance().factoryTyoe(ProductType.NETWORK).getRetrofit("http://82.156.173.100:9999/").create(TypeApi.class);//RetrofitFactory.getInstance().create(TypeApi.class);//

//        Log.i("--a", "video: "+api.getVideo("2","1","20"));
        return api.getVideo(channelid+"",page+"","20");
    }
}
